home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / usr / lib / mozilla-firefox / idl / nsIScriptableDateFormat.idl < prev    next >
Text File  |  2006-05-08  |  6KB  |  122 lines

  1. /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
  2. /* ***** BEGIN LICENSE BLOCK *****
  3.  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
  4.  *
  5.  * The contents of this file are subject to the Mozilla Public License Version
  6.  * 1.1 (the "License"); you may not use this file except in compliance with
  7.  * the License. You may obtain a copy of the License at
  8.  * http://www.mozilla.org/MPL/
  9.  *
  10.  * Software distributed under the License is distributed on an "AS IS" basis,
  11.  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
  12.  * for the specific language governing rights and limitations under the
  13.  * License.
  14.  *
  15.  * The Original Code is mozilla.org code.
  16.  *
  17.  * The Initial Developer of the Original Code is
  18.  * Netscape Communications Corporation.
  19.  * Portions created by the Initial Developer are Copyright (C) 1998
  20.  * the Initial Developer. All Rights Reserved.
  21.  *
  22.  * Contributor(s):
  23.  *
  24.  * Alternatively, the contents of this file may be used under the terms of
  25.  * either of the GNU General Public License Version 2 or later (the "GPL"),
  26.  * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
  27.  * in which case the provisions of the GPL or the LGPL are applicable instead
  28.  * of those above. If you wish to allow use of your version of this file only
  29.  * under the terms of either the GPL or the LGPL, and not to allow others to
  30.  * use your version of this file under the terms of the MPL, indicate your
  31.  * decision by deleting the provisions above and replace them with the notice
  32.  * and other provisions required by the GPL or the LGPL. If you do not delete
  33.  * the provisions above, a recipient may use your version of this file under
  34.  * the terms of any one of the MPL, the GPL or the LGPL.
  35.  *
  36.  * ***** END LICENSE BLOCK ***** */
  37.  
  38. #include "nsISupports.idl"
  39.  
  40. typedef long nsDateFormatSelector;
  41. %{ C++
  42. enum
  43. {
  44.     kDateFormatNone = 0,            // do not include the date  in the format string
  45.     kDateFormatLong,                // provides the long date format for the given locale
  46.     kDateFormatShort,               // provides the short date format for the given locale
  47.     kDateFormatYearMonth,           // formats using only the year and month 
  48.     kDateFormatWeekday              // week day (e.g. Mon, Tue)
  49. };
  50. %}
  51.  
  52. typedef long nsTimeFormatSelector;
  53. %{ C++
  54. enum
  55. {
  56.     kTimeFormatNone = 0,            // don't include the time in the format string
  57.     kTimeFormatSeconds,             // provides the time format with seconds in the  given locale 
  58.     kTimeFormatNoSeconds,           // provides the time format without seconds in the given locale 
  59.     kTimeFormatSecondsForce24Hour,  // forces the time format to use the 24 clock, regardless of the locale conventions
  60.     kTimeFormatNoSecondsForce24Hour // forces the time format to use the 24 clock, regardless of the locale conventions
  61. };
  62. %}
  63.  
  64. %{C++
  65. // Define Contractid and CID
  66. // {2EA2E7D0-4095-11d3-9144-006008A6EDF6}
  67. #define NS_SCRIPTABLEDATEFORMAT_CID \
  68. { 0x2ea2e7d0, 0x4095, 0x11d3, { 0x91, 0x44, 0x0, 0x60, 0x8, 0xa6, 0xed, 0xf6 } }
  69.  
  70. #define NS_SCRIPTABLEDATEFORMAT_CONTRACTID "@mozilla.org/intl/scriptabledateformat;1"
  71.  
  72. extern NS_IMETHODIMP
  73. NS_NewScriptableDateFormat(nsISupports* aOuter, REFNSIID aIID, void** aResult);
  74. %}
  75.  
  76. [scriptable, uuid(0c89efb0-1aae-11d3-9141-006008a6edf6)]
  77. interface nsIScriptableDateFormat : nsISupports {
  78.  
  79.     const long dateFormatNone = 0;                 // do not include the date  in the format string
  80.     const long dateFormatLong =1;                  // provides the long date format for the given locale
  81.     const long dateFormatShort =2;                 // provides the short date format for the given locale
  82.     const long dateFormatYearMonth =3;             // formats using only the year and month 
  83.     const long dateFormatWeekday = 4;              // week day (e.g. Mon, Tue)
  84.  
  85.     // Notes:
  86.     // The original definitions of dateFormatLong and dateFormatShort are from windows platform. 
  87.     // dateFormatLong output will be like: Wednesday, January 29, 2003 4:02:14 PM
  88.     // dateFormatShort output will be like: 1/29/03 4:02:14 PM
  89.     // On platforms like Linux and OS2, it is rather difficult to achieve exact same output, and since we are aiming 
  90.     // at human readers, it does not make sense to achieve exact same result. We should do just enough as the platform
  91.     // allow us to do, unless there is other strong reasons for other approaches. 
  92.  
  93.     const long timeFormatNone = 0;                 // don't include the time in the format string
  94.     const long timeFormatSeconds = 1;              // provides the time format with seconds in the  given locale 
  95.     const long timeFormatNoSeconds = 2;            // provides the time format without seconds in the given locale
  96.     const long timeFormatSecondsForce24Hour = 3;   // forces the time format to use the 24 clock, regardless of the locale conventions
  97.     const long timeFormatNoSecondsForce24Hour = 4; // forces the time format to use the 24 clock, regardless of the locale conventions
  98.  
  99.     // format date and time, locale is language country pair (e.g. en-US) or empty string for application default
  100.     wstring FormatDateTime(in wstring locale, 
  101.                            in long dateFormatSelector, 
  102.                            in long timeFormatSelector,
  103.                            in long year, 
  104.                            in long month, 
  105.                            in long day, 
  106.                            in long hour, 
  107.                            in long minute, 
  108.                            in long second);
  109.     // format date, locale is language country pair (e.g. en-US) or empty string for application default
  110.     wstring FormatDate(in wstring locale, 
  111.                        in long dateFormatSelector, 
  112.                        in long year, 
  113.                        in long month, 
  114.                        in long day);
  115.     // format time, locale is language country pair (e.g. en-US) or empty string for application default
  116.     wstring FormatTime(in wstring locale, 
  117.                        in long timeFormatSelector,
  118.                        in long hour, 
  119.                        in long minute, 
  120.                        in long second);
  121. };
  122.